# print("Hello")
# def build_profile(first,last,**user_info):
#     profile={}
#     profile['first_name']=first
#     profile['last_name']=last
#     for key ,value in user_info.items():
#         profile[key]=value
    
#     return profile

# user_profile=build_profile('albert','einstein',
#                             location='princeton',
#                             field='physics')
# print(user_profile)
# def make_pizza(size,*toppings):
#     print("\nMaking a "+str(size)+
#         "-inch pizza with the following topping:")
#     for topping in toppings:
#         print("- "+topping)
# class Dog():

#     def __init__(selt,name,age):
#         selt.name=name
#         selt.age=age

#     def sit(selt):
#         print(selt.name.title()+" is now sitting.")

#     def roll_over(selt):
#         print(selt.name.title()+" rooll_over!")

# my_dog=Dog('willie',6)
# # print("My dog's name is "+my_dog.name.title()+".")
# # print("My dog is "+str(my_dog.age)+" years old.")
# # my_dog.sit()
# # my_dog.roll_over()
# your_dog=Dog('luck',3)
# print("My dog's name is "+my_dog.name.title()+".")
# print("My dog is "+str(my_dog.age)+" years old.")
# my_dog.sit()
# print("\n your dog's name is "+your_dog.name.title()+".")
# print("You dog is "+str(your_dog.age)+" years old.")
# your_dog.sit()
# class Restaurant():
#     def __init__(selt,restant_name,cuisine_type):
#         selt.restant_name=restant_name
#         selt.cuisine_type=cuisine_type
    
#     def describe_restaurant(selt):
#         print(selt.restant_name.title())
#         print(str(selt.cuisine_type))
    
#     def Open_restaurant(selt):
#         print("餐厅正在营业！！！")

# restaurant=Restaurant('willie',6)
# print(restaurant.restant_name.title())
# print(str(restaurant.cuisine_type))
# print("\n")
# restaurant.describe_restaurant()
# restaurant.Open_restaurant()
# class User():
#     def __init__(selt,first_name,last_name):
#         selt.first_name=first_name
#         selt.last_name=last_name

#     def sescribe_user(selt):
#         print("first name:"+selt.first_name.title()+
#               "last name:"+str(selt.last_name))

#     def green_user(selt):
#         print("欢迎来到.py世界")     

# user=User('y','x')
# print(user.first_name.title())
# print(user.last_name.title())

# user.sescribe_user()
# user.green_user()
class Car():

    def __init__(self,make,model,year):

        self.make=make
        self.model=model
        self.year=year
        self.odometer_reading=0

    def get_descriptive_name(self):

        long_name=str(self.year)+' '+self.make+' '+self.model
        return long_name.title()
    
    def read_odomenter(self):
        print("This car has "+str(self.odometer_reading)+" miles on it.")

    def update_odometer(self,mileage):
        if mileage>=self.odometer_reading:
            self.odometer_reading=mileage
        else:
            print("You can't roll back an odometer!")
    
    def increment_odomenter(self,miles):
        self.odometer_reading+=miles

class ElectricCar(Car):
    def __init__(self,make,model,year):
        super().__init__(make,model,year)
        self.battery_size=70

    def describe_battery(self):
        print("This car has a "+str(self.battery_size)+" -kWh batttery.")

my_tesla=ElectricCar('tesla','model s',2016)
print(my_tesla.get_descriptive_name())
my_tesla.describe_battery()

# my_new_car=Car('audi','a4',2016)
# print(my_new_car.get_descriptive_name())
# my_new_car.read_odomenter()
# my_new_car.odometer_reading=23
# my_new_car.read_odomenter()
# my_new_car.update_odometer(23)
# my_new_car.read_odomenter()
# my_used_car=Car('subaru','outback','2013')
# print(my_used_car.get_descriptive_name())

# my_used_car.update_odometer(23500)
# my_used_car.read_odomenter()

# my_used_car.increment_odomenter(100)
# my_used_car.read_odomenter()
